package com.ts.mapper.achievement;

import com.ts.entity.Member;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MonographMemberMapper {
    @Insert("<script>" +
            "INSERT INTO ts_monograph_member " +
            "(project_id, position, name, unit) " +
            "VALUES " +
            "<foreach collection='list' item='item' separator=','>" +
            "(#{item.projectId}, #{item.position}, #{item.name}, #{item.unit})" +
            "</foreach>" +
            "</script>")
    void batchInsert(@Param("list") List<Member> members);
    @Delete("DELETE FROM ts_monograph_member WHERE project_id = #{projectId}")
    void deleteByProjectId(Long projectId);

    @Select("SELECT * FROM ts_monograph_member WHERE project_id = #{projectId}")
    List<Member> selectByProjectId(Long projectId);
}
